; Homing XYU axis if they are not homed


M564 H0
G91
G1 Z20
G90
M564 H1

G28 Y
G28 X
G28 U

T0                                    ; Select first tool
G90                                   ; Absolute positioning


M204 P2500 T2500                     ; set accelerations
M280 P0 S{global.probePickAngle}     ; Move probe holder to the 'pick/place' position
G4S1

; Go to probe pickup position
G1 f18000 Y150 X{global.probePickX} U{move.axes[3].max-10} F18000
G1 f18000 Y{move.axes[1].max-5}


M291 S3 P"Press ""OK"" to save new X pos (Y jogging only for convenience)" X1 Y1

set global.probePickX = move.axes[0].machinePosition
; Generate pickupposition.g
echo >"0:/user/pickupposition.g" "; Set X probe pickup position"
echo >>"0:/user/pickupposition.g" "if exists(global.probePickX)"
echo >>"0:/user/pickupposition.g" "  set global.probePickX = "^{global.probePickX}
echo >>"0:/user/pickupposition.g" "else"
echo >>"0:/user/pickupposition.g" "  global probePickX = "^{global.probePickX}

M98 P"pick.g" R1
M400
M98 P"pick.g" R1
M400

M98 P"place.g"

M204 P5000 T5000                     ; set accelerations